package testcasegeneration

import (
	"strconv"
)

func binaryTree(dataLen int) string {
	resArr := make([]int, 0, dataLen)
	fatherRecord := make([]int, dataLen)
	for i := 0; i < dataLen; i++ {
		resArr = append(resArr, randomIntData(0, dataLen))
	}

	resArrPyString := "BTREE(["
	for i := range resArr {
		if i == 0 || (randomIntData(0, 20) > 1 && fatherRecord[(i-1)/2] != 1) {
			resArrPyString += strconv.Itoa(resArr[i])
			fatherRecord[i] = 0
		} else {
			fatherRecord[i] = 1
			resArrPyString += "None"
		}

		if i != len(resArr)-1 {
			resArrPyString += ","
		}
	}
	resArrPyString += "])"

	return resArrPyString
}
